import jsonCycle from 'json-cycle'
export const setItem = (key, value) => {
  if (typeof value === 'object') {
    value = JSON.stringify(jsonCycle.decycle(value))
  }
  sessionStorage.setItem(key, value)
}
export const getItem = (key) => {
  try {
    return jsonCycle.retrocycle(JSON.parse(sessionStorage.getItem(key)))
  } catch (error) {
    return sessionStorage.getItem(key)
  }
}
export const removeItem = (key) => {
  sessionStorage.removeItem(key)
}
